package com.wuxiaofan.product.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wuxiaofan.product.entity.SpuInfoDesc;
import com.wuxiaofan.product.entity.custom.SpuInfoDescCustom;
import com.wuxiaofan.product.mapper.SpuInfoDescMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wuxiaofan.product.client.Idgenerator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;

@Service
public class SpuInfoDescService {
    @Autowired
    private SpuInfoDescMapper pmsSpuInfoDescMapper;
    @Resource
    private Idgenerator idgenerator;
    public SpuInfoDesc findById(String id){
        return pmsSpuInfoDescMapper.selectById(id);
    }

    public SpuInfoDescCustom findCountByMap(Map paraMap){
        return pmsSpuInfoDescMapper.findCountByMap(paraMap);
    }

    public SpuInfoDescCustom findGroupByMap(Map paraMap){
        return pmsSpuInfoDescMapper.findGroupByMap(paraMap);
    }

    public List<SpuInfoDescCustom> findByMap(Map paraMap){
        return pmsSpuInfoDescMapper.findByMap(paraMap);
    }

    public Page<SpuInfoDescCustom> findByMap(Map paraMap, Page page){
        return page.setRecords(pmsSpuInfoDescMapper.findByMap(paraMap,page));
    }


    public void updateMapById(Map paraMap){
        pmsSpuInfoDescMapper.updateMapById(paraMap);
    }
    public void delById(String id){
        pmsSpuInfoDescMapper.deleteById(id);
    }

    public SpuInfoDesc save(SpuInfoDesc pmsSpuInfoDesc){
        pmsSpuInfoDesc.setSpuId(idgenerator.getId());
        pmsSpuInfoDescMapper.insert(pmsSpuInfoDesc);
        return pmsSpuInfoDesc;
    }

}
